﻿using CatUtils.Utils.Currency;
using CatUtils.Utils.Currency.IoUtils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RabbitDownload.WebSite.Local.LstHelper
{
    /// <summary>
    /// Lst文件去重复
    /// </summary>
    internal class LstRepeat
    {
        /// <summary>
        /// 文件去重复。
        /// </summary>
        /// <param name="FloderPath"></param>
        public static void FloderRepeat(string FloderPath)
        {
            List<string> AllContentLine = new List<string>();//存储所有Lst
            List<string> FileList = FloderNameHelper.GetFullFileNameList(FloderPath, "*.lst");
            int TempCount = 0;
            foreach (var FilePathItem in FileList)
            {
                new PrintLog().PercentLog(FileList.Count, TempCount++);
                List<string> ContentTemp = new List<string>();
                foreach (var ContentLineItem in FileHelper.ReadAllLine(FilePathItem))
                {
                    if (AllContentLine.Contains(ContentLineItem))
                        continue;
                    AllContentLine.Add(ContentLineItem);
                    ContentTemp.Add(ContentLineItem);
                }
                FileHelper.WriteList(FileNameHelper.CreateFileNameWithChildFloder(FilePathItem, "列表去重复", true), ContentTemp);
            }
        }
    }
}